<!--
Created by IntelliJ IDEA.
User: iulianacosmina
Date: 2019-07-14
Time: 11:43
-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">

  <head th:replace="~{templates/layout :: pageTitle('Singer Page')}"></head>

  <body>
    <div class="container">
      <header th:replace="~{templates/layout :: pageHeader}" ></header>

      <header th:replace="~{templates/layout :: pageMenu}" ></header>

      <section th:fragment="~{templates/layout :: pageContent}">
        <div class="card border-info mb-3" style="max-width: 20rem;">
          <div class="card-header" th:text="#{singer.title}"/>
          <div class="card-body">
            <table>
              <tr>
                <th th:text="#{label.Singer.firstname}">FN</th>
                <td th:text="${singer.firstName}">FN</td>
              </tr>
              <tr>
                <th th:text="#{label.Singer.lastname}">LN</th>
                <td th:text="${singer.lastName}">LN</td>
              </tr>
              <tr>
                <th th:text="#{label.Singer.birthDate}">BD</th>
                <td th:text="${singer.birthDate}">BD</td>
              </tr>
              <tr th:if="${singer.photo != null}">
                <td colspan="2">
                  <img class="card-img-top" th:src="@{/singer/} + ${singer.id} + '/photo'">
                </td>
              </tr>
              <tr>
                <td colspan="2">
                  <a th:href="@{/singer/} + ${singer.id} + '/edit'"
                     th:text="#{command.edit}"
                     class="btn-success">EDIT</a>
                </td>
                <td >
                  <a th:href="@{/singer/} + ${singer.id} + '/upload'"
                     th:text="#{command.update.photo}"
                     class="btn-success">UPLOAD_PHOTO</a>
                </td>
              </tr>
            </table>
            <div class="container col-lg-12">
              <form th:object="${singer}" th:action="@{/singer/} + ${singer.id}" th:method="delete"  class="col p-3">
                <!-- temporarily remove sec:authorize="hasRole('ADMIN')" to test the @PreAuthorize annotation -->
                <input sec:authorize="hasRole('ADMIN')"  type="submit" th:value="#{command.delete}" id="deleteButton" class="btn btn-danger"/>
              </form>
            </div>
          </div>
        </div>
      </section>

      <footer th:replace="~{templates/layout :: pageFooter}" ></footer>
    </div>
  </body>
</html>